﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.Data;

namespace IHISCETeim.Web.MachineSys.UserModel
{
    public partial class AlarmList : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.查看,Permission.修改 };
            }
        }
        protected override string DWZRef
        {
            get
            {
                return "AlarmList";
            }
        }
        #region 属性 (查询条件)


        protected string AlarmDate
        {
            get
            {
                return DateTime.Now.ToString("yyyy-MM-dd");
            }
        }
        protected string Birthday
        {
            get
            {
                return DateTime.Now.ToString("MM-dd");
            }
        }
        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            if (GetRequestValue<string>("ajaxmethod", "") == "checkalarm")
            {
                checkalarm();
            }

            DataBind();
        }
        /// <summary>
        /// 检查是否有警报信息，如果有则输入1反之输出0
        /// </summary>
        protected void checkalarm()
        {
            DataTable dt = UOneMonthAlarmController.GetPagination(AlarmDate, 1, 99999, "IntoDate DESC", ref TotalCount);
            if (TotalCount > 0)
            {
                Response.Write("1");
            }
            else
            {
                Response.Write("0");
            }
            Response.End();
        }

        protected void DataBind()
        {
            //  string wheresql = QueryOperatorsEnumHelper.ConvertCommonOperator(CommonFiled, QueryOperatorsEnum.包含, CommonValue);

            this.rpOneMonth.DataSource = UOneMonthAlarmController.GetPagination(AlarmDate, 1, 99999, "IntoDate DESC", ref TotalCount);
            this.rpOneMonth.DataBind();

           // this.rpBirthday.DataSource = UBirthdayAlarmController.GetPagination(Birthday, 1, 99999, "UWCID DESC", ref TotalCount);
           // this.rpBirthday.DataBind();

           // this.rpKeepAlarm.DataSource = UMacKeepController.UMacKeepAlarm_GetALL();
            //this.rpKeepAlarm.DataBind();
        }
    }
}